package com.huodongjia.controller;

import com.huodongjia.pojo.Activity;
import com.huodongjia.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/activity")
public class ActivityController {
    @Autowired
    ActivityService activityService;
    @RequestMapping("/findAll")
    public List<Activity> findAll(){
        return activityService.findAll();
    }
    @RequestMapping("/search")
    public List<Activity> search(String searchText){
        return activityService.search(searchText);
    }
    @RequestMapping("/findById")
    public Activity findById(int activityId){
        return activityService.findById(activityId);
    }
    @RequestMapping("/findByUserid")
    public List<Activity> findByUserid(int userid){
        return activityService.findByUserid(userid);
    }
    @RequestMapping("/delete")
    public void delete(int activityId){
        activityService.delete(activityId);
    }
}
